<template>
  <div class="ma-content-block lg:flex justify-between p-4">
    <!-- CRUD 组件 -->
    <ma-crud :options="options" :columns="columns" ref="crudRef">
    </ma-crud>
  </div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import printLabel from '@/api/logistics/printLabel'
import { Message } from '@arco-design/web-vue'
import tool from '@/utils/tool'
import * as common from '@/utils/common'
import dictHelp from "@/utils/dicthelp.js";

const crudRef = ref()

const options = reactive({
  id: 'print_label',
  pageLayout: 'fixed',
  rowSelection: {
    showCheckedAll: true
  },
  pk: 'id',
  tabs:{
    dataIndex:'type'
  },
  formOption: {
    viewType: 'drawer',
    width: '80%'
  },
  api: printLabel.getList,
  recycleApi: printLabel.getRecycleList,
  add: {
    show: true,
    api: printLabel.save,
    auth: ['logistics:printLabel:save']
  },
  edit: {
    show: true,
    api: printLabel.update,
    auth: ['logistics:printLabel:update']
  },
  delete: {
    show: true,
    api: printLabel.deletes,
    auth: ['logistics:printLabel:delete'],
  },
  recovery: {
    show: true,
    api: printLabel.recoverys,
    auth: ['logistics:printLabel:recovery']
  }
})

const columns = reactive([
  {
    title: "主键",
    dataIndex: "id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    settingHide:true,
  },
  {
    title: "模板类型",
    dataIndex: "type",
    addDefaultValue:'1',
    formType: "radio",
    type:'button',
    search: true,
    hide: true,
    settingHide:true,
    commonRules: {required: true, message: "请选择模板类型"},
    dict: {name: "printType", translation: true}
  },
  {
    title: "模板名称",
    dataIndex: "name",
    formType: "input",
    search: true,
    commonRules: {
      required: true,
      message: "请输入模板名称"
    }
  },
  {
    title: "服务",
    dataIndex: "services",
    formType: "select",
    multiple: true,
    virtualListProps:{},
    dict:dictHelp.service,
    hide: true
  },
  {
    title: "国家",
    dataIndex: "countrys",
    formType: "select",
    multiple: true,
    hide: true,
    dict: {name: "countrys", translation: true}
  },
  {
    title: "用户",
    dataIndex: "users",
    formType: "select",
    multiple: true,
    dict:dictHelp.customer,
    // hide: true
  },
  {
    title: "宽度",
    dataIndex: "width",
    addDefaultValue:'100',
    formType: "input-number"
  },
  {
    title: "高度",
    dataIndex: "height",
    addDefaultValue:'100',
    formType: "input-number"
  },
  {
    title: "优先级",
    dataIndex: "level",
    addDefaultValue:100,
    formType: "input-number",
  },
  {
    title: "内容",
    dataIndex: "description",
    formType: "editor",
    hide: true
  },
  {
    title: "创建者",
    dataIndex: "created_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "更新者",
    dataIndex: "updated_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "创建时间",
    dataIndex: "created_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "更新时间",
    dataIndex: "updated_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "删除时间",
    dataIndex: "deleted_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "备注",
    dataIndex: "remark",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  }
])
</script>
<script> export default { name: 'logistics:printLabel' } </script>